home *** CD-ROM | disk | FTP | other *** search
- /************************************************************************************/
- /* */
- /* PowerFrax */
- /* --------- */
- /* */
- /* Motorola compiler command line: */
- /* mcc HFDocMandelbrot.c -c -i ::includes: -O3 */
- /* */
- /* © DayStar Digital, Inc. 1995-1996 */
- /* All Rights Reserved. */
- /* */
- /************************************************************************************/
-
- #include "HFDocMandelbrot.h"
-
- /*==================================================================================*/
- long main( void *params ) {
- /* Generates one fractal scan. */
- /* This is the MPWorkFunctionProc called from the tasks. */
- /* When using the Multiprocessing API Library this function is called from fTask() */
- /* in HFMultiprocessingPPC.c. When the Multiprocessing API Library is not present */
- /* it is called directly from PowerFrax. */
-
- long i;
- double lzc;
- double lzd;
- double lstep;
- double lescape;
- long lwidth;
- char *lresults;
-
- lzc = ((sMandelbrotParamsPtr)params)->zc;
- lzd = ((sMandelbrotParamsPtr)params)->zd;
- lstep = ((sMandelbrotParamsPtr)params)->step;
- lescape = ((sMandelbrotParamsPtr)params)->escape;
- lwidth = ((sMandelbrotParamsPtr)params)->width;
- lresults = ((sMandelbrotParamsPtr)params)->results;
-
- for( i = 0; i < lwidth; i++ ) {
- double za = 0.0;
- double zb = 0.0;
- double ze = 0.0;
- long level = 0;
- while( level < 256 && ze < lescape ) {
- double za2 = za * za;
- double zb2 = zb * zb;
- double zt = za * zb;
- za = za2 - zb2 + lzc;
- zb = zt + zt + lzd;
- ze = za2 + zb2;
- level++;
- }
- *lresults++ = level - 1;
- lzc += lstep;
- }
-
- return( 0 );
- }
-
- /*==================================================================================*/
-